package command;

import javax.swing.JButton;
import javax.swing.JTextField;

import visitor.CalculDerivataVisitor;
import visitor.CalculVisitor;
import visitor.DerivareVisitor;
import arbori.ArboreFunctional;

public class DerivareCommand extends ArgDependentCommand implements Command {

	ArboreFunctional functie;
	JTextField derivataTF;
	
	public DerivareCommand(String nume, JTextField afisareTF) {
		setText(nume);
		//this.functie = functie;
		this.functie = ArgDependentCommand.getFunctie();
		derivataTF = afisareTF;
	}
	
	/**
	 * afisaza in interfata rezultatul calculului derivarii functiei
	 */
	public void execute() {
		this.functie = ArgDependentCommand.getFunctie();
		CalculDerivataVisitor cdVisitor = new CalculDerivataVisitor();
		functie.getRadacina().setX(valX);
		functie.acceptVisitor(cdVisitor);
		derivataTF.setText(cdVisitor.toString());

	}
	

}


